package net.int0r.gscore.gobjects;

import net.int0r.gscore.util.GJSONObject;
import net.int0r.gscore.util.GStringUtil;

public class Stamp {
	private String tier = "";
	private int checkinCount = 0;
	private String imageUrl = "";
	private String firstVisited = "";
	private String name = "";
	private String cityState = "";
	private String url = "";
	public String getTier() {
		return tier;
	}
	public void setTier(String tier) {
		this.tier = tier;
	}
	public int getCheckinCount() {
		return checkinCount;
	}
	public void setCheckinCount(int checkinCount) {
		this.checkinCount = checkinCount;
	}
	public String getImageUrl() {
		return imageUrl;
	}
	public void setImageUrl(String imageUrl) {
		this.imageUrl = imageUrl;
	}
	public String getFirstVisited() {
		return firstVisited;
	}
	public void setFirstVisited(String firstVisited) {
		this.firstVisited = firstVisited;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getCityState() {
		return cityState;
	}
	public void setCityState(String cityState) {
		this.cityState = cityState;
	}
	public String getUrl() {
		return url;
	}
	public void setUrl(String url) {
		this.url = url;
	}
	
	public int getSpotId() {
		return GStringUtil.getId(getUrl());
	}
	
	public Stamp(GJSONObject theObj) {
		try {
			setTier(theObj.getString("tier"));
			setCheckinCount(theObj.getInt("checkins_count"));
			setImageUrl(theObj.getString("image_url"));
			setFirstVisited(theObj.getString("first_visited_at"));
			setName(theObj.getString("name"));
			setCityState(theObj.getString("city_state"));
			setUrl((new Spot(new GJSONObject(theObj.getJSONObject("spot").toString())).getUrl()));
		}
		catch(Exception ex) {
			ex.printStackTrace();
		}
	}
	
	public String toString() {
		return("\ngetCheckinCount(): "+getCheckinCount()
				+"\ngetCityState(): "+getCityState()
				+"\ngetFirstVisited(): "+getFirstVisited()
				+"\ngetImageUrl(): "+getImageUrl()
				+"\ngetName(): "+getName()
				+"\ngetSpotId(): "+getSpotId()
				+"\ngetTier(): "+getTier()
				+"\ngetUrl(): "+getUrl());
	}
}
